home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- import sub_arctic.lib.sub_arctic_error;
- import sub_arctic.output.loaded_image;
- import sub_arctic.output.drawable;
- import sub_arctic.input.move_press_draggable;
- import sub_arctic.input.event;
- import java.awt.Point;
-
- /**
- * An icon (displayed image) object which can be dragged. (This could also be
- * done by placing an icon in a drag_container, but since this was built first
- * and is more compact, we leave it.)
- *
- * @author Scott Hudson
- */
- public class drag_icon extends icon implements move_press_draggable {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor.
- * @param int x initial x position of the object.
- * @param int y initial y position of the object.
- * @param loaded_image img the image to display for the icon.
- */
- public drag_icon(int x, int y, loaded_image img)
- {
- super(x,y,img);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle the start of a drag to the object.
- *
- * @param event evt the event "causing" the start of the drag.
- * @param int xv the new x position of this object (in parent's
- * coords).
- * @param int yv the new y position of this object (in parent's
- * coords).
- * @param int gx the initial grab x position of the drag (in local
- * coords).
- * @param int gy the initial grab x position of the drag (in local
- * coords).
- * @param Object user_info information associated with this object at the
- * time it requested the drag focus.
- */
- public boolean drag_start(
- event evt, int xv, int yv, int gx, int gy, Object user_info)
- {
- /* move our position */
- set_pos(xv,yv);
- return true;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle a movement during a drag. Here we just set our position to
- * follow the event location.
- *
- * @param event evt the event "causing" the start of the drag.
- * @param int x_pos the new x position of this object (in parent's
- * coords).
- * @param int y_pos the new y position of this object (in parent's
- * coords).
- * @param int start_x the initial grab x position of the drag (in local
- * coords).
- * @param int start_y the initial grab x position of the drag (in local
- * coords).
- * @param int grab_x the initial grab x position of the drag (in local
- * coords).
- * @param int grab_y the initial grab x position of the drag (in local
- * coords).
- * @param Object user_info information associated with this object at the
- * time it requested the drag focus.
- */
- public boolean drag_feedback(
- event evt,
- int x_pos, int y_pos,
- int start_x, int start_y,
- int grab_x, int grab_y,
- Object user_info)
- {
-
- /* move our position */
- set_pos(x_pos, y_pos);
- return true;
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle input corresponding to the end of a drag.
- *
- * @param event evt the event "causing" the start of the drag.
- * @param int x_pos the new x position of this object (in parent's
- * coords).
- * @param int y_pos the new y position of this object (in parent's
- * coords).
- * @param int start_x the initial grab x position of the drag (in local
- * coords).
- * @param int start_y the initial grab x position of the drag (in local
- * coords).
- * @param int grab_x the initial grab x position of the drag (in local
- * coords).
- * @param int grab_y the initial grab x position of the drag (in local
- * coords).
- * @param Object user_info information associated with this object at the
- * time it requested the drag focus.
- */
- public boolean drag_end(
- event evt,
- int x_pos, int y_pos,
- int start_x, int start_y,
- int grab_x, int grab_y,
- Object user_info)
- {
- /* let drag_feedback to all the work */
- return drag_feedback(evt, x_pos, y_pos, start_x, start_y, grab_x, grab_y,
- user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-